<style>
  .cloud-btn-export {
    margin-bottom: 10px;
    margin-top: -20px;
  }
</style>
<template>
  <div>
    <btn-export :tableData="list" :tableTitle="columns" :title="title" class="cloud-btn-export"></btn-export>
    <Table
      :columns="columns"
      :data="tableData"
      border>
    </Table>
  </div>
</template>
<script>
import BtnExport from '_c/btn-export'
export default {
  name: 'CustomerTable',
  components: {
    BtnExport
  },
  props: {
    tableData: null,
    page: '',
    pageSize: '',
    title: '',
    list: null
  },
  data () {
    return {
      columns: [
        {
          title: '序号',
          type: 'index2',
          width: 100,
          align: 'center',
          render: (h, params) => {
            return h('span', params.index + (this.page - 1) * this.pageSize + 1)
          }
        },
        {
          title: '创建日期',
          key: 'ctime',
          // width: 150,
          align: 'center'
        },
        {
          title: '客户姓名',
          key: 'uname',
          // width: 150,
          align: 'center'
        },
        {
          title: '客户电话',
          key: 'tel',
          // width: 150,
          align: 'center'
        },
        {
          title: '预约日期',
          key: 'appointime',
          // width: 150,
          align: 'center'
        },
        {
          title: '状态',
          key: 'state',
          // width: 150,
          align: 'center',
          render: (h, params) => {
            return h(
              'span',
              {},
              params.row.state === '0' ? '未预约' : params.row.state === '1' ? '已预约' : params.row.state === '2' ? '未到访' : params.row.state === '3' ? '已到店' : params.row.state === '4' ? '已签约' : params.row.state === '5' ? '已退款' : '-'
              // params.row.method
            )
          }
        },
        {
          title: '到店时间',
          key: 'comdate',
          align: 'center',
          // width: 150
          render: (h, params) => {
            return h('span', params.row.comdate ? this.$moment(params.row.comdate).format('YYYY-MM-DD') : '-')
          }
        },
        {
          title: '商品',
          key: 'tname',
          align: 'center'
          // width: 150
        },
        {
          title: '签约金额(元)',
          key: 'cprice',
          align: 'center'
          // width: 160
        },
        {
          title: '佣金明细(元)',
          key: 'commission',
          align: 'center'
          // width: 154
        }
      ]
    }
  }
}
</script>
